
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class RmsCleaningRuleConfigServiceImpl implements RmsCleaningRuleConfigService  {

    @Resource
    private RmsCleaningRuleConfigMapper rmsCleaningRuleConfigMapper;

    /**
     * 获取 RmsCleaningRuleConfig 分页列表
     */
    @Transactional
    public IPage getRmsCleaningRuleConfigPagination( PaginationVo paginationVo, RmsCleaningRuleConfigQuery rmsCleaningRuleConfigQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<RmsCleaningRuleConfigEntity> lqs = new LambdaQueryWrapper();
        rmsCleaningRuleConfigMapper.selectPage(page, lqs);

        List<RmsCleaningRuleConfigEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 RmsCleaningRuleConfig 所有数据
     *
    */
    @Transactional
    public List<RmsCleaningRuleConfigEntity> getRmsCleaningRuleConfigAllList( RmsCleaningRuleConfigQuery rmsCleaningRuleConfigQuery ) throws Exception {

        LambdaQueryWrapper<RmsCleaningRuleConfigEntity> lqs = new LambdaQueryWrapper();
        List<RmsCleaningRuleConfigEntity> list = rmsCleaningRuleConfigMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 RmsCleaningRuleConfig 详情
    */
    @Transactional
    public RmsCleaningRuleConfigEntity getRmsCleaningRuleConfigDetail( Long id) throws Exception {

        RmsCleaningRuleConfigEntity rmsCleaningRuleConfig = rmsCleaningRuleConfigMapper.selectById(id);
        return rmsCleaningRuleConfig;
    }


    /**
     * 新增 RmsCleaningRuleConfig
     * */
    @Transactional
    public void addRmsCleaningRuleConfig(RmsCleaningRuleConfigVo rmsCleaningRuleConfigVo) throws Exception {

        RmsCleaningRuleConfigEntity rmsCleaningRuleConfig = new RmsCleaningRuleConfigEntity();
        ReflectionCopy.copyProperties( rmsCleaningRuleConfig, rmsCleaningRuleConfigVo );
        rmsCleaningRuleConfigMapper.insert(rmsCleaningRuleConfig);
        return;
    }


    /**
     * 更新 RmsCleaningRuleConfig
     * */
    @Transactional
    public void updateRmsCleaningRuleConfig( RmsCleaningRuleConfigVo rmsCleaningRuleConfigVo) throws Exception {

        if( rmsCleaningRuleConfigVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        RmsCleaningRuleConfigEntity rmsCleaningRuleConfig = new RmsCleaningRuleConfigEntity();
        ReflectionCopy.copyProperties( rmsCleaningRuleConfig, rmsCleaningRuleConfigVo );
        rmsCleaningRuleConfigMapper.updateById(rmsCleaningRuleConfig);
        return;
    }

    /**
     * 删除 RmsCleaningRuleConfig
     * */
    @Transactional
    public void batchRemoveRmsCleaningRuleConfig( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        rmsCleaningRuleConfigMapper.deleteBatchIds(ids);
    }

}

      